<template>
  <div class="box">
    <div class="box-title">经营功能</div>
    <div class="menu-list flex">

      <div class="menu-item" @click="handleClickMenu(item)" v-for="(item,index) in menuWay" :key="index">
        <i-icon class="icon" size="50rpx"  :name="item.icon"></i-icon>
        <div class="title">{{item.title}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { getShopInfo } from "@/api/shops";
export default {
  data() {
    return {
      menuWay: [
        {
          title: "店铺",
          icon: "home-3-line",
          value: "shop",
        },
        {
          title: "商品",
          icon: "shopping-bag-fill",
          value: "goods",
        },
        {
          title: "订单",
          icon: "list-unordered",
          value: "order",
        },
        {
          title: "评论",
          icon: "chat-smile-2-line",
          value: "comment",
        },
        {
          title: "售后",
          icon: "customer-service-2-line",
          value: "afterSales",
        },
        {
          title: "投诉",
          icon: "discuss-line",
          value: "complaint",
        },
        {
          title: "结算",
          icon: "money-cny-circle-line",
          value: "bill",
        },
        {
          title: "消息",
          icon: "message-line",
          value: "message",
        },
        {
          title: "分类",
          icon: "align-justify",
          value: "category",
        },
        {
          title: "发票",
          icon: "money-cny-box-line",
          value: "receipt",
        },
        
      ],
	  storeData: {}, //店铺详情
    };
  },
  created() {
  	this.init()
  },
  methods: {
	  // 初始化店铺详情
	  async init() {
	    let res = await getShopInfo();
	    if (res.data.success) {
	      this.storeData = res.data.result;
	    }
	  },
    handleClickMenu(val) {
      console.log(val);
      switch (val.value) {
        case "order":
          uni.navigateTo({
            url: "/pages/order/orderList",
          });
          break;
        case "goods":
          uni.navigateTo({
            url: "/pages/goods/goodsList",
          });
          break;
        case "comment":
          uni.navigateTo({
            url: "/pages/order/comment/list",
          });
          break;
        case "afterSales":
          uni.navigateTo({
            url: "/pages/order/afterSales/list",
          });
          break;
        case "complaint":
          uni.navigateTo({
            url: "/pages/order/complaint/list",
          });
          break;
        case "bill":
          uni.navigateTo({
            url: "/pages/order/bill/list",
          });
          break;
        case "message":
          uni.navigateTo({
            url: "/pages/other/message/list",
          });
          break;
        case "setUp":
          uni.navigateTo({
            url: "/pages/other/setUp",
          });
        case "category":
          uni.navigateTo({
            url: "/pages/other/setup/category",
          });
          break;
        case "receipt":
          uni.navigateTo({
            url: "/pages/other/setup/receipt",
          });
          break;
		case "shop":
         uni.navigateTo({
           url: `/pages/other/setup/shopDetail`,
         });
         break;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/pages/tabbar/home/template/styles.scss";
.menu-list {
  align-items: center;
  margin-top: 48rpx;
  flex-wrap: wrap;
}
.menu-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-bottom: 48rpx;
  font-size: 50rpx;
  width: 20%;
  border-radius: 50%;
  color: #333;
}
</style>